package com.xiaopan.business.blog.controller;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by panzhaopeng
 */
@Controller
public class ViewController {

    private static final Logger LG = Logger.getLogger(ViewController.class);

    /**
     * 跳到登陆页
     * @return
     */
    @RequestMapping(value = "/login")
    public ModelAndView toLogin() {
        return new ModelAndView("/jsp/login");
    }

    @RequestMapping("/view/{filename}")
    public String toPage(@PathVariable("filename") String filename) {
        String targetUrl = "/jsp/" + filename.replaceAll("\\.", "/");
        return targetUrl;
    }
}
